<template>
<card>
    <h4 slot="header" class="card-title">管理员信息</h4>
<el-form ref="form"  :rules="rules"  :model="form" label-width="100px"   class="demo-ruleForm">

   <el-form-item label="姓名" required prop="name">
    <el-input v-model="form.name"></el-input>
  </el-form-item>
   <el-form-item label="工号" required prop="cid">
    <el-input v-model="form.cid"></el-input>
  </el-form-item>
  <el-form-item label="性别" required prop="gender">
    <el-radio-group v-model="form.gender">
      <el-radio label="男"></el-radio>
      <el-radio label="女"></el-radio>
    </el-radio-group>
  </el-form-item>
  <el-form-item label="权限" required prop="role">
    <el-select v-model="form.role" placeholder="请选择权限">
      <el-option label="超级管理员" value="shanghai"></el-option>
      <el-option label="业主管理员" value="beijing"></el-option>
    </el-select>
  </el-form-item>
  
  <el-form-item label="注册时间" prop="date1">
    <el-col :span="11">
      <el-date-picker type="date" placeholder="选择日期" v-model="form.date1" style="width: 100%;"></el-date-picker>
    </el-col>
   
   
  </el-form-item>
  
 
  
  <el-form-item label="备注">
    <el-input type="textarea" v-model="form.desc"></el-input>
  </el-form-item>
  <el-form-item>
    <el-button type="primary" @click="onSubmit">增加</el-button>
    <el-button @click="back">返回</el-button>
  </el-form-item>
</el-form>
</card>
</template>
<script>
  export default {
    data() {
      return {
        form: {
          name: '',
          role: '',
          cid:'',
          date1: '',
          gender: '',
          address: '',
          desc: ''
        },
        rules: {
          name: [
            { required: true, message: '请输入名字', trigger: 'blur' }
          ],
          role: [
            { required: true, message: '请选择权限', trigger: 'change' }
          ],
          date1: [
            { type: 'date', required: true, message: '请选择日期', trigger: 'change' }
          ],
           cid: [
            { required: true, message: '请输入工号', trigger: 'change' }
          ],
           gender: [
            { required: true, message: '请输入性别', trigger: 'change' }
          ],


         
          
        }
      }
    },
    methods: {
      onSubmit() {
        this.$refs['form'].validate((valid) => {
          if (valid) {
            alert('submit!');
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      back(){
          this.$router.go(-1);
      }
    }
  }
</script>